package com.wtwd.device.constant;

/**
 * 是否为在线发送
 * <p>
 * isOnline
 * retransmission
 * 不填默认为在线指令 且不做重发,默认后面一条指令覆盖前面一条
 */
public enum MsgTypeEnum {
    DEVICE_LOGIN("DEVICE_LOGIN", "设备登录"),

    DEVICE_OFFLINE("DEVICE_OFFLINE", "设备离线"),

    //占定除开登录下线其他均为一般指令
    GENERAL_CMD("GENERAL_CMD", "一般指令处理器"),

    REPORT_HEARTBEAT("REPORT_HEARTBEAT", "心跳包"),

    REPORT_LOCATION_INFO("REPORT_LOCATION_INFO", "位置上报"),


    W_HRTSTART("W_HRTSTART", "设置心率检测频率"),

    W_OXTSTART("W_OXTSTART","设置血氧检测频率"),

    W_BP_FREQUENCY("W_BP_FREQUENCY","设置血压检测频率"),

    W_EM_FREQUENCY("W_EM_FREQUENCY","设置情绪检测频率"),

    W_SPORTDATA("W_SPORTDATA", "手表上报运动数据"),




    SET_HR_THRESHOLD("SET_HR_THRESHOLD", "设置终端心率预警值"),

    SET_OX_THRESHOLD("SET_OX_THRESHOLD","设置终端血氧预警值"),

    SET_BP_THRESHOLD("SET_BP_THRESHOLD","设置终端血压预警值"),

    ALARM_POWER("ALARM_POWER","电量警报"),

    ALARM_HEALTH("ALARM_HEALTH","健康警报"),

    REPORT_SOS("REPORT_SOS","SOS触发警报"),

    W_SLEEPRAWDATA("W_SLEEPRAWDATA","睡眠数据上报"),

    SET_CLOCK_ACTION("SET_CLOCK_ACTION","设置设备行为闹钟"),

    SET_NORMAL_BUTTON("SET_NORMAL_BUTTON","设置普通按键和sos按键"),

    DEVICE_STATE_PUSH("DEVICE_STATE_PUSH", "设备在线状态 ，占用于设备在线离线"),

    W_PHL("W_PHL","设置电话本"),
    W_SOS("W_SOS","设置sos号码"),


    REMOTE_OPERATE_TERMINAL("REMOTE_OPERATE_TERMINAL","远程终端操作"),

    W_CHECK_UPDATE("W_CHECK_UPDATE","手表主动检测更新"),

    LOCATION_INFO_GET("LOCATION_INFO_GET","实时位置获取"),

    //#########################################################################################################################
    //app指令
    APP_LOGIN("APP_LOGIN", "APP登录指令"),


    APP_OFFLINE("APP_OFFLINE", "APP离线"),

    APP_KA("APP_KA", "app心跳"),



    APP_W_PHL("APP_W_PHL","app设置电话本"),
    APP_GENERAL_CMD("APP_GENERAL_CMD", "app一般指令处理器"),

    PUSH_LOCATION_APP("PUSH_LOCATION_APP", "推送定位到app"),

    APP_SET_W_HRTSTART("SET_W_HRTSTART", "设置心率频率"),

    APP_SET_FREQUENCY("APP_SET_FREQUENCY", "APP 设置频率"),

    APP_SET_HEART_RATE_WARNING("APP_SET_HEART_RATE_WARNING", "app设置心率预警值"),

    APP_SET_BLOOD_OXYGEN_WARNING("APP_SET_BLOOD_OXYGEN_WARNING", "app设置血氧预警值"),

    APP_SET_BLOOD_PRESSURE_WARNING("APP_SET_BLOOD_PRESSURE_WARNING","app设置血压预警值"),

    APP_SET_NORMAL_BUTTON("APP_SET_NORMAL_BUTTON","app设置普通按键和sos按键"),

    PUSH_APP_STEP("PUSH_APP_STEP", "app推送一般步数"),

    PUSH_SLEEP_DATA_APP("PUSH_SLEEP_DATA_APP","推送睡眠数据到app"),

    APP_SET_ALARM_CLOCK("APP_SET_ALARM_CLOCK","app设置闹钟"),

    APP_W_SOS("APP_W_SOS","设置sos号码"),

    APP_SET_REMOTE_OPERATE_TERMINAL("APP_SET_REMOTE_OPERATE_TERMINAL","app远程终端操作"),

    APP_LOCATION_INFO_GET("APP_LOCATION_INFO_GET","APP实时获取设备位置"),
    ;


    /**
     * 指令名称
     */
    private String cmdName;

    private String msg;

    /**
     * 默认在线指令
     */
    private boolean isOnline = true;

    /**
     * 重发次数
     */
    private Integer retransmission;

    public String getCmdName() {
        return cmdName;
    }

    public void setCmdName(String cmdName) {
        this.cmdName = cmdName;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isOnline() {
        return isOnline;
    }

    public void setOnline(boolean online) {
        isOnline = online;
    }

    public Integer getRetransmission() {
        return retransmission;
    }

    public void setRetransmission(Integer retransmission) {
        this.retransmission = retransmission;
    }

    MsgTypeEnum(String cmdName, String msg) {
        this.cmdName = cmdName;
        this.msg = msg;
    }

    MsgTypeEnum(String cmdName, String msg, boolean isOnline, Integer retransmission) {
        this.cmdName = cmdName;
        this.msg = msg;
        this.isOnline = isOnline;
        this.retransmission = retransmission;
    }

    public static MsgTypeEnum getMsgTypeEnum(String cmdName) {
        for (MsgTypeEnum value : MsgTypeEnum.values()) {
            if (cmdName.equals(value.cmdName)) {
                return value;
            }
        }
        return null;
    }

}
